package com.tonggedata.dataapi.dto;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.tonggedata.dataapi.entity.ApiConfig;
import com.tonggedata.dataapi.entity.ApiGroup;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;

/**
 * api业务分组表
 * <p>
 * response返参  DTO
 *
 * @author tonggedata
 * @date 2022-06-19 12:59:36
 */
@Data
public class ApiGroupDto {
    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    private Long id;
    /**
     * 根目录:-1
     */
    private Integer pid;
    /**
     * name
     */
    private String name;
    /**
     * 描述
     */
    private String desc;
    /**
     * 创建人
     */
    private String createUser;
    /**
     * 更新人
     */
    private String updateUser;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 分组下的Api
     */
    private List<ApiConfigDto> children;

    public ApiGroupDto() {
    }

    public void set(ApiGroup apiGroup) {
        this.id = apiGroup.getId();
        this.pid = apiGroup.getPid();
        this.name = apiGroup.getName();
        this.desc = apiGroup.getDesc();
        this.createUser = apiGroup.getCreateUser();
        this.updateUser = apiGroup.getUpdateUser();
        this.createTime = apiGroup.getCreateTime();
        this.updateTime = apiGroup.getUpdateTime();
    }

}
